<?php
	class Table extends Element{
		private $header = "";
		private $cols = 0;
		private $rows = 0;
		
		public function __construct($header, $class){
			$this->cols = count($header);
			$this->header = $header;
			$this->class = $class;
		}
		
		public function getCode(){
			$head = "<table class='".$this->class."'><tr>";
			foreach($this->header as $line){
				$head = $head."<th>".$line."</th>";
			}
			$this->code = $head."</tr>".$this->code."</table>";
			return $this->code;
		}
		
		public function setClass($class){
			$this->class = $class;
		}
		
		public function setCols($cols){
			$this->cols = $cols;
		}
		
		public function setRows($rows){
			$this->rows = $rows;
		}
		
		public function getClass(){
			return $this->class;
		}
		
		public function getCols(){
			return $this->cols;
		}
		
		public function getRows(){
			return $this->rows;
		}
		
		public function addHeader($header){
			$this->cols = count($header);
			$this->header = $header;
		}
		
		public function addRow($array){
			$this->code = $this->code."<tr>";
			foreach($array as $line){
				$this->code = $this->code."<td>".$line."</td>";
			}
			$this->code = $this->code."</tr>";
			$this->rows += 1;
		}
	}
?>